package com.educate.common.web;

import java.util.Collection;

public class CollectionUtils {

    public static String toString(Collection<String> collection) {
        if (collection == null || collection.isEmpty()) {
            return "";
        }

        StringBuilder stringBuilder = null;
        for (String item : collection) {
            if (stringBuilder == null) {
                stringBuilder = new StringBuilder();
                stringBuilder.append(item);
            } else {
                stringBuilder.append(",").append(item);
            }
        }
        return stringBuilder.toString();
    }
}
